package com.fromfuture.xuhuidoc.android.fragments;

import android.app.Fragment;
import android.content.Context;
import android.content.Intent;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;
import android.os.Bundle;
import android.os.Environment;
import android.os.Handler;
import android.os.Message;
import android.provider.MediaStore;
import android.support.annotation.Nullable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Editable;
import android.text.TextUtils;
import android.text.TextWatcher;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.fromfuture.xuhuidoc.R;
import com.fromfuture.xuhuidoc.android.BroadcastReceiver.MyConsultRoomBroadcastReceiver;
import com.fromfuture.xuhuidoc.android.BroadcastReceiver.MyConsultRoomBroadcastReceiver02;
import com.fromfuture.xuhuidoc.android.Interface.Interface;
import com.fromfuture.xuhuidoc.android.adapter.MyConsultRoomAdapter02;
import com.fromfuture.xuhuidoc.android.base.BaseWebActivity;
import com.fromfuture.xuhuidoc.android.bean.MyConsultRoom02RecycleViewInfo;
import com.fromfuture.xuhuidoc.android.callback.BlActivityToMyConsultRoomFra02Callbak;
import com.fromfuture.xuhuidoc.android.callback.Doc_close_Video_Callback;
import com.fromfuture.xuhuidoc.android.callback.MyConsultRoomFra01ToFra02;
import com.fromfuture.xuhuidoc.android.callback.MyConsultRoomFra02ToFra01;
import com.fromfuture.xuhuidoc.android.callback.MyConsultRoomFragment02FreshRecycleview;
import com.fromfuture.xuhuidoc.android.customview.MyItemAnimator;
import com.fromfuture.xuhuidoc.android.utils.BitmapUtils;
import com.fromfuture.xuhuidoc.android.utils.FileUtils;
import com.fromfuture.xuhuidoc.cordova.plugin.MyConsultRoomPlugin;
import com.fromfuture.xuhuidoc.cordova.untils.CordovaAppManager;

import org.json.JSONException;
import org.json.JSONObject;

import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.util.ArrayList;
import java.util.List;

import app.auto.runner.base.action.ViewInflater;
import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

import static io.dcloud.common.util.ReflectUtils.getApplicationContext;

/**
 * Author：何送军
 * creation time：2017/8/26
 **/
public class MyConsultRoomFragment02 extends Fragment implements TextWatcher, MyConsultRoomFra01ToFra02,
        MyConsultRoomFragment02FreshRecycleview {
    @BindView(R.id.my_consult_room_02_edit)
    EditText editText;
    @BindView(R.id.my_consult_room_02_yuyin_btn)
    Button button_yuyin;
    @BindView(R.id.my_consult_room_02_add_button)
    ImageView imageView_addbutton;
    @BindView(R.id.my_consult_room_02_send_text)
    Button button_sendtext;
    @BindView(R.id.my_consult_room_02_more_button)
    LinearLayout linearLayout_morebtn;
    @BindView(R.id.my_consult_room_02_send_photo)
    LinearLayout linearLayout_send_photo;
    @BindView(R.id.my_consult_room_02_send_takephoto)
    LinearLayout linearLayout_send_takephoto;
    @BindView(R.id.my_consult_room_02_send_video)
    LinearLayout linearLayout_send_video;
    @BindView(R.id.my_consult_room_02_send_zhuanzhen)
    LinearLayout linearLayout_send_zhuanzhen;
    @BindView(R.id.my_consult_room_02_send_bl)
    LinearLayout linearLayout_send_bl;
    @BindView(R.id.my_consult_room_02_phone_btn)
    TextView phone_btn;
    @BindView(R.id.my_consult_room_02_linear_layout01)
    LinearLayout MyConsultRoomFragment02_linearLayout01;
    @BindView(R.id.my_consult_room_02_linear_layout02)
    RelativeLayout MyConsultRoomFragment02_inearLayout02;
    @BindView(R.id.my_consult_room_02_big_photo)
    ImageView imageView_big;


    private View rootview;
    private boolean Isyuyin = false;
    private boolean IsSendAdd = false;
    private boolean IsMoreBtn = true;
    private String tag = "MyConsultRoomFragment02:-->";
    private Bitmap photo;
    private Bitmap photo_big;
    private String picPath;
    private String fra02blguid;

    private MyConsultRoomAdapter02 myConsultRoomAdapter02;

    private List<MyConsultRoom02RecycleViewInfo> list;
    private List<String> list_isdocpat;
    private MyConsultRoom02RecycleViewInfo myConsultRoom02RecycleViewInfo;
    private String doc_pat_type;
    private MyConsultRoomBroadcastReceiver myConsultRoomBroadcastReceiver;
    private MyConsultRoomBroadcastReceiver02 myConsultRoomBroadcastReceiver02;
    private RecyclerView recyclerView;
    private static Doc_open_video doc_open_video;
    private MyConsultRoomPlugin myConsultRoomPlugin;
    private PatExitRoomCallBack patExitRoomCallBack;

    private MyConsultRoomFra02ToFra01 myConsultRoomFra02ToFra01;


    public MyConsultRoomFragment02() {
    }

    private String docguid;
    private String patguid;
    private String docsendmsg;

    private void setdocGuid(String docguid) {
        this.docguid = docguid;
    }

    public String getDocguid() {
        return docguid;
    }

    private void setpatguidfr02(String patguid) {
        this.patguid = patguid;
    }

    public String getPatguid() {
        return patguid;
    }

    public String getDocsendmsg() {
        return docsendmsg;
    }

    public void setDocsendmsg(String docsendmsg) {
        this.docsendmsg = docsendmsg;
    }

    public String getDoc_pat_type() {
        return doc_pat_type;
    }

    public void setDoc_pat_type(String doc_pat_type) {
        this.doc_pat_type = doc_pat_type;
    }

    public void setPatExitRoomCallBack(PatExitRoomCallBack patExitRoomCallBack) {
        this.patExitRoomCallBack = patExitRoomCallBack;
    }

    public String getFra02blguid() {
        return fra02blguid;
    }

    public void setFra02blguid(String fra02blguid) {
        this.fra02blguid = fra02blguid;
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        rootview = new ViewInflater(getApplicationContext()).inflate(R.layout.activity_my_consult_room_02, container, false);
        ButterKnife.bind(this, rootview);
        init();
        return rootview;
    }

    @Override
    public void onAttach(Context context) {
        super.onAttach(context);
        doc_open_video = (Doc_open_video) getActivity();
    }

    private void init() {
        myConsultRoomPlugin = new MyConsultRoomPlugin();
        ButtonListener b = new ButtonListener();
        findViewById();
        editText.addTextChangedListener(this);
        button_yuyin.setOnClickListener(b);
        button_yuyin.setOnTouchListener(b);
        ConsultRoom_02_recyclerView();
        callbackReceive();

    }

    Handler handler = new Handler();

    private void findViewById() {
        myConsultRoomFra02ToFra01 = (MyConsultRoomFra02ToFra01) getFragmentManager().findFragmentByTag("myConsultRoomFragment01");
        imageView_addbutton = (ImageView) rootview.findViewById(R.id.my_consult_room_02_add_button);
        button_sendtext = (Button) rootview.findViewById(R.id.my_consult_room_02_send_text);
        MyConsultRoomFragment02_linearLayout01 = (LinearLayout) rootview.findViewById(R.id.my_consult_room_02_linear_layout01);
        MyConsultRoomFragment02_inearLayout02 = (RelativeLayout) rootview.findViewById(R.id.my_consult_room_02_linear_layout02);
        phone_btn = (TextView) rootview.findViewById(R.id.my_consult_room_02_phone_btn);
        linearLayout_send_photo = (LinearLayout) rootview.findViewById(R.id.my_consult_room_02_send_photo);
        linearLayout_send_takephoto = (LinearLayout) rootview.findViewById(R.id.my_consult_room_02_send_takephoto);
        linearLayout_send_video = (LinearLayout) rootview.findViewById(R.id.my_consult_room_02_send_video);
        linearLayout_send_zhuanzhen = (LinearLayout) rootview.findViewById(R.id.my_consult_room_02_send_zhuanzhen);
        linearLayout_send_bl = (LinearLayout) rootview.findViewById(R.id.my_consult_room_02_send_bl);
        linearLayout_morebtn = (LinearLayout) rootview.findViewById(R.id.my_consult_room_02_more_button);
        imageView_big = (ImageView) rootview.findViewById(R.id.my_consult_room_02_big_photo);
    }

    private void ConsultRoom_02_recyclerView() {
        list = new ArrayList<MyConsultRoom02RecycleViewInfo>();
        list_isdocpat = new ArrayList<String>();
        recyclerView = (RecyclerView) rootview.findViewById(R.id.my_consult_room_02_recyclerView);
//        recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.VERTICAL_LIST));
//        recyclerView.addItemDecoration(new DividerItemDecoration(getActivity(), DividerItemDecoration.HORIZONTAL_LIST));
        recyclerView.setItemAnimator(new MyItemAnimator());
        LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity()
                , LinearLayoutManager.VERTICAL, false
        );
        recyclerView.setLayoutManager(linearLayoutManager);
        myConsultRoomAdapter02 = new MyConsultRoomAdapter02(getActivity(), list, list_isdocpat);
        recyclerView.setAdapter(myConsultRoomAdapter02);
        patadditem();
    }

    /**
     * onClick事件开始
     */
    @OnClick(R.id.my_consult_room_02_yuyin_img)
    void yuyin_img() {
        if (!Isyuyin) {
            editText.setVisibility(View.VISIBLE);
            button_yuyin.setVisibility(View.GONE);
            Isyuyin = true;
        } else {
            editText.setVisibility(View.GONE);
            button_yuyin.setVisibility(View.VISIBLE);
            Isyuyin = false;
        }
    }

    @OnClick(R.id.my_consult_room_02_add_button)
    void addbutton() {
        if (IsMoreBtn) {
            linearLayout_morebtn.setVisibility(View.VISIBLE);
            IsMoreBtn = false;
        } else {
            linearLayout_morebtn.setVisibility(View.GONE);
            IsMoreBtn = true;
        }
    }

    @OnClick(R.id.my_consult_room_02_send_text)
    void sendtext() {
        String msg = editText.getText().toString();
        Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
        if (!TextUtils.isEmpty(msg)) {
            docadditem(msg);
            MyConsultRoomPlugin.docsendMessageText01(getPatguid(), msg);
            setDocsendmsg(msg);
            editText.getText().clear();
        } else {
            Toast.makeText(getActivity(), "信息不能为空", Toast.LENGTH_SHORT).show();
        }

    }

    public void sendtext(String bliid, String txt) {
        editText.setText(txt);
        editText.setTag(bliid);
        String msg = editText.getText().toString();
        Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT).show();
        if (!TextUtils.isEmpty(msg)) {
            docadditem(msg).setPatblguid(bliid);
            ;
            MyConsultRoomPlugin.docsendMessageText01(getPatguid(), msg);
            setDocsendmsg(msg);
            editText.getText().clear();
        } else {
            Toast.makeText(getActivity(), "信息不能为空", Toast.LENGTH_SHORT).show();
        }

    }


    @OnClick(R.id.my_consult_room_02_phone_btn)
    void phone_btn() {
        MyConsultRoomFragment02_linearLayout01.setVisibility(View.VISIBLE);
        MyConsultRoomFragment02_inearLayout02.setVisibility(View.GONE);
        CordovaAppManager.mycordovaWebView.loadUrl("javascript:" + "docCloseVideo(\'" + "" + "\')");
    }

    @OnClick(R.id.my_consult_room_02_send_photo)
    void my_consult_room_02_send_photo() {
        Intent intent = new Intent(
                Intent.ACTION_PICK,
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI);
        // 设定结果返回
        startActivityForResult(intent, 200);

    }

    @OnClick(R.id.my_consult_room_02_send_takephoto)
    void my_consult_room_02_send_takephoto() {
        String state = Environment.getExternalStorageState();// 获取内存卡可用状态
        if (state.equals(Environment.MEDIA_MOUNTED)) {
            // 内存卡状态可用
            Intent intent = new Intent("android.media.action.IMAGE_CAPTURE");
            intent.putExtra(MediaStore.EXTRA_OUTPUT, FileUtils.createImageFileOriginal());
            startActivityForResult(intent, 100);
        } else {
            // 不可用
            Toast.makeText(getActivity(), "内存不可用", Toast.LENGTH_LONG)
                    .show();
        }
    }

    @OnClick(R.id.my_consult_room_02_send_video)
    void my_consult_room_02_send_video() {
        Toast.makeText(getActivity(), "" + getDocguid() + "   " + getPatguid(), Toast.LENGTH_SHORT).show();
        MyConsultRoomPlugin.my_openvideo(getPatguid(), getDocguid());
        MyConsultRoomFragment02_linearLayout01.setVisibility(View.INVISIBLE);
        MyConsultRoomFragment02_inearLayout02.setVisibility(View.VISIBLE);
    }

    @OnClick(R.id.my_consult_room_02_send_zhuanzhen)
    void my_consult_room_02_send_zhuanzhen() {
        Toast.makeText(getActivity(), "" + getDocguid() + "   " + getPatguid(), Toast.LENGTH_SHORT).show();
        MyConsultRoomPlugin.my_openaudio(getPatguid(), getDocguid());
        MyConsultRoomFragment02_linearLayout01.setVisibility(View.INVISIBLE);
        MyConsultRoomFragment02_inearLayout02.setVisibility(View.VISIBLE);
    }

    @OnClick(R.id.my_consult_room_02_send_bl)
    void my_consult_room_02_send_bl() {
//        MyConsultRoomPlugin.docsendBl();

        Intent intent = new Intent(getActivity(), BaseWebActivity.class).putExtra("name", "newRecord.html?sickguid=" + getPatguid()).putExtra("save_js", "doaddbl");
        startActivity(intent);

    }

    @OnClick(R.id.my_consult_room_02_big_photo)
    void big_photo() {
        imageView_big.setVisibility(View.GONE);
    }

    /**
     * onClick事件结束
     * */
    /**
     * beforeTextChanged()  onTextChanged()  afterTextChanged() 这三个方法是 editText编辑框的变化状态
     */
    @Override
    public void beforeTextChanged(CharSequence s, int start, int count, int after) {
    }

    @Override
    public void onTextChanged(CharSequence s, int start, int before, int count) {
    }

    @Override
    public void afterTextChanged(Editable s) {
        /** 得到光标开始和结束位置 ,超过最大数后记录刚超出的数字索引进行控制 */
        if (s.length() > 0) {
            button_sendtext.setVisibility(View.VISIBLE);
            imageView_addbutton.setVisibility(View.GONE);

        } else {
            button_sendtext.setVisibility(View.GONE);
            imageView_addbutton.setVisibility(View.VISIBLE);
        }
    }

    private Handler mHandler = new Handler() {

        public void handleMessage(Message msg) {
            super.handleMessage(msg);
//            myConsultRoomAdapter02.MyConsultRoomAddData(new MyConsultRoom02RecycleViewInfo());
        }

    };

    //来自fra01的病人info
    @Override
    public void setArgs(Bundle args) {
        String content = args.getString("content");
        try {
            JSONObject jsonObject = new JSONObject(content);
            setdocGuid(jsonObject.getString("DocGuid"));
            setpatguidfr02(jsonObject.getString("Pat_guid"));
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }

    //第二个病人的诊室进来刷新fra2里面的recycleview，去除前一个人的信息
    @Override
    public void refresh() {
        list.clear();
        list_isdocpat.clear();
        myConsultRoomAdapter02.notifyDataSetChanged();
    }

    private class ButtonListener implements View.OnClickListener, View.OnTouchListener {

        public void onClick(View v) {
            if (v.getId() == R.id.my_consult_room_02_yuyin_btn) {
            }
        }

        public boolean onTouch(View v, MotionEvent event) {
            if (v.getId() == R.id.my_consult_room_02_yuyin_btn) {
                if (event.getAction() == MotionEvent.ACTION_UP) {
                    button_yuyin.setText("按住录音");
                }
                if (event.getAction() == MotionEvent.ACTION_DOWN) {
                    button_yuyin.setText("正在录音……");
                }
            }
            return false;
        }
    }


    private MyConsultRoom02RecycleViewInfo docadditem(String msg) {
        myConsultRoom02RecycleViewInfo = new MyConsultRoom02RecycleViewInfo();
        myConsultRoom02RecycleViewInfo.setTextView_right_text(msg);
        myConsultRoom02RecycleViewInfo.setTextView_right_name("我");

        if (fra02blguid != null) {
            myConsultRoom02RecycleViewInfo.setPatblguid(fra02blguid);
            fra02blguid = null;
        }
        if (photo != null) {
            myConsultRoom02RecycleViewInfo.setBitmap_right(photo);
            if (photo_big != null) {
                Log.d("大小--》", "大");
                myConsultRoom02RecycleViewInfo.setBitmap_big(photo_big);
            } else {
                Log.d("大小--》", "小");
                myConsultRoom02RecycleViewInfo.setBitmap_big(photo);
            }

            photo = null;
            photo_big = null;
        }

        list.add(myConsultRoom02RecycleViewInfo);
        list_isdocpat.add("doc");
        myConsultRoomAdapter02.notifyDataSetChanged();
        return myConsultRoom02RecycleViewInfo;
    }

    private void patadditem() {
        myConsultRoomBroadcastReceiver02 = new MyConsultRoomBroadcastReceiver02(new MyConsultRoomBroadcastReceiver02.Receivepatmsg_interface() {
            @Override
            public void receivepatmsg(String info) {
                try {
                    JSONObject myJsonObject = new JSONObject(info);
                    myConsultRoom02RecycleViewInfo = new MyConsultRoom02RecycleViewInfo();
                    myConsultRoom02RecycleViewInfo.setTextView_left_text(myJsonObject.getString("ReceiveMsg"));
                    myConsultRoom02RecycleViewInfo.setTextView_left_name(myJsonObject.getString("Pic_name"));
                    myConsultRoom02RecycleViewInfo.setPatguid(myJsonObject.getString("PatGuid"));
                    myConsultRoom02RecycleViewInfo.setBitmap_left_url(myJsonObject.optString("Content_imgSrc_url"));

                    list.add(myConsultRoom02RecycleViewInfo);
                    list_isdocpat.add("pat");
                    myConsultRoomAdapter02.notifyDataSetChanged();
                } catch (JSONException e) {
                    e.printStackTrace();
                }
            }
        });
    }

    private void callbackReceive() {
        //医生关闭视频和患者退出诊室,(大部分是指正在接诊的患者退出)
        myConsultRoomPlugin.setDoc_close_video_callback(new Doc_close_Video_Callback() {
            @Override
            public void closevideo(String who_exit, int pos) {//此pos是碎片1中第几个item
                if (who_exit.equals("doc_close_video")) {
                    MyConsultRoomFragment02_linearLayout01.setVisibility(View.VISIBLE);
                    MyConsultRoomFragment02_inearLayout02.setVisibility(View.GONE);
                } else if (who_exit.equals("pat_exit_room")) {
                    patExitRoomCallBack.pat_exit_room("");
                    //传值告诉碎片1中第几个item的状态改变
                    Bundle bundle = new Bundle();
                    bundle.putString("exit_pos", pos + "");
                    myConsultRoomFra02ToFra01.setArgs(bundle);
                }
            }
        });
        myConsultRoomPlugin.setBlActivityToMyConsultRoomFra02Callbak(new BlActivityToMyConsultRoomFra02Callbak() {
            @Override
            public void sendblguid(String blguid) {
                setFra02blguid(blguid);
                docadditem("");
            }
        });

    }


    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        if (data != null) {
            switch (requestCode) {
                case 100:
// 两种方式 获取拍好的图片
                    if (data.getData() != null || data.getExtras() != null) { // 防止没有返回结果
                        Uri uri = data.getData();
                        if (uri != null) {
                            this.photo = BitmapFactory.decodeFile(uri.getPath()); // 拿到图片
                            this.photo_big = BitmapFactory.decodeFile(uri.getPath());
                        }
                        if (photo == null) {
                            Bundle bundle = data.getExtras();
                            if (bundle != null) {

                                this.photo = (Bitmap) bundle.get("data");
                                Log.d("photo的长度为2：", ((Bitmap) bundle.get("data")).getByteCount() + "");
                                FileOutputStream fileOutputStream = null;
                                try {
// 打开文件输出流

                                    File file = FileUtils.createImageFile();
                                    fileOutputStream = new FileOutputStream(file);
// 生成图片文件
                                    this.photo.compress(Bitmap.CompressFormat.JPEG,
                                            100, fileOutputStream);
// 相片的完整路径
                                    this.picPath = file.getPath();
// 将图片显示到界面上
                                    this.photo = BitmapUtils.getBitmap(file.getPath(), 360, 540);
                                    Log.d("photo的长度为3：", this.photo.getByteCount() + "");
                                    docadditem("");
//把路径传给诊室js
                                    if (file.getPath() != null) {
                                        MyConsultRoomPlugin.docsendMessagePhoto(file.getPath());
                                    }

                                } catch (Exception e) {
                                    e.printStackTrace();
                                } finally {
                                    if (fileOutputStream != null) {
                                        try {
                                            fileOutputStream.close();
                                        } catch (Exception e) {
                                            e.printStackTrace();
                                        }
                                    }
                                }
                                Toast.makeText(getApplicationContext(), "获取到了",
                                        Toast.LENGTH_SHORT).show();


                            } else {
                                Toast.makeText(getApplicationContext(), "找不到图片",
                                        Toast.LENGTH_SHORT).show();
                            }
                        }
                    }
                    break;
                case 200: {
//打开相册并选择照片，这个方式选择单张
// 获取返回的数据，这里是android自定义的Uri地址
                    Uri selectedImage = data.getData();
                    String[] filePathColumn = {MediaStore.Images.Media.DATA};
// 获取选择照片的数据视图
                    Cursor cursor = getActivity().getContentResolver().query(selectedImage,
                            filePathColumn, null, null, null);
                    cursor.moveToFirst();
// 从数据视图中获取已选择图片的路径
                    int columnIndex = cursor.getColumnIndex(filePathColumn[0]);
                    String picturePath = cursor.getString(columnIndex);
                    cursor.close();

//                    this.photo=BitmapFactory.decodeFile(picturePath);
//                    this.photo_big=BitmapFactory.decodeFile(picturePath);
//                    Log.d("photo的长度为：", BitmapFactory.decodeFile(picturePath).getByteCount() + "");
                    FileOutputStream fileOutputStream = null;
                    File file = FileUtils.createImageFile();
                    this.photo = BitmapUtils.getBitmap(picturePath, 360, 540);
                    try {
                        fileOutputStream = new FileOutputStream(file);
                        this.photo.compress(Bitmap.CompressFormat.JPEG,
                                100, fileOutputStream);
                        Log.d("photo的长度为1：", this.photo.getByteCount() + "");
                    } catch (FileNotFoundException e) {
                        e.printStackTrace();
                    } finally {
                        if (fileOutputStream != null) {
                            try {
                                fileOutputStream.close();
                            } catch (Exception e) {
                                e.printStackTrace();
                            }
                        }
                    }


// 将图片显示到界面上
                    docadditem("");
//把路径传给诊室js
                    if (picturePath != null) {
                        MyConsultRoomPlugin.docsendMessagePhoto(picturePath);
                    }
                    break;
                }
                default:
                    break;
            }
        }
    }

    //定义一个回调接口
    public interface Doc_open_video {
        public void openvideo(String strValue);
    }

    public static void doc_open_video() {
        doc_open_video.openvideo("hidefra");
    }

    //定义一个回调接口,患者退出诊室，activity中实现，隐藏碎片2，展现碎片1
    public interface PatExitRoomCallBack {
        public void pat_exit_room(String strValue);
    }

}
